/* 
 * File:   main.cpp
 * Author: epulapp
 *
 * Created on 22 avril 2014, 09:24
 */

#include <iostream>
#include <cstdlib>

#include <chrono>
#include <ctime>
#include <thread>

#include "TSPClasses.hpp"
#include "TSPFile.hpp"


using namespace std;

/*
 * 
 */
//int main(int argc, char** argv) {
//	cout << "test TSP" << endl;
//    string file = "C:\\Alex\\workspace\\VoyageurDeCommerce\\data\\wi29.tsp";
//    TSPFile* tspf = new TSPFile(file);
//    return 0;
//}


// the function f() does some time-consuming work
void f() {
    volatile double d;
    for(int n=0; n<5000; ++n)
       for(int m=0; m<1000; ++m)
           d += d*n*m;
}

int main() {
//    std::clock_t c_start = std::clock();
//    auto t_start = std::chrono::high_resolution_clock::now();
//    time_t timer = time(NULL);

    std::thread t1(f);
    std::thread t2(f); // f() is called on two threads
    t1.join();
    t2.join();
//    std::clock_t c_end = std::clock();
//    auto t_end = std::chrono::high_resolution_clock::now();
//
//    std::cout << "CPU time used: "
//              << 1000 * (c_end-c_start) / CLOCKS_PER_SEC
//              << " ms\n";
//    std::cout << "Wall clock time passed: "
//    		<< difftime(time(NULL), timer) << " / "
//              << std::chrono::duration_cast<std::chrono::seconds>(t_end - t_start).count()
//              << " ms\n";
}
